unit F_AgregarDocumento;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, JvExStdCtrls,
  JvEdit, JvValidateEdit, Mask, JvExMask, JvSpin;

type
  TF_AddDocument = class(TForm)
    Panel_Central: TPanel;
    Panel2: TPanel;
    SB_Cancelar: TBitBtn;
    SB_Aceptarr: TBitBtn;
    Label_Pagina_Inicial: TLabel;
    Label_Pagina_Final: TLabel;
    Edit_Inicial: TJvValidateEdit;
    Edit_Final: TJvValidateEdit;
    Label_Copias: TLabel;
    JvSE_Copias: TJvSpinEdit;
    procedure NumericEditKeyPress(Sender: TObject;  var Key: Char);
    procedure SB_AceptarrClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    constructor Create(NombreDocumento: String; PageCount:integer);
  end;

implementation

{$R *.dfm}

constructor TF_AddDocument.Create(NombreDocumento: String; PageCount:integer);
begin
  inherited Create(nil);
  Caption:= Caption + NombreDocumento;

  Edit_Inicial.MaxValue:= PageCount;
  Edit_Final.MaxValue:= PageCount;
  Edit_Final.Value:= PageCount;
  JvSE_Copias.Value:= 1;
end;

procedure TF_AddDocument.NumericEditKeyPress(Sender: TObject;  var Key: Char);
begin
  if not ((Key in ['0'..'9', #0..#31]) or ((Key in ['/',',']) and ((Pos('/', TEdit(Sender).Text) = 0) and (Pos(',', TEdit(Sender).Text) = 0)) and (Length(TEdit(Sender).Text)>0))) then
    begin
      Key := #0;
      MessageBeep(MB_ICONEXCLAMATION);
    end
end;
procedure TF_AddDocument.SB_AceptarrClick(Sender: TObject);
begin
  if (StrToIntDef(Edit_Inicial.Text,0) <= StrToIntDef(Edit_Final.Text,0)) then
    ModalResult:= mrOk;
end;

end.
